#pragma once

#include <map>
using std::map;
#include <deque>
using std::deque;

#include "../Threading/Thread.h"
#include "../Threading/Lockable.h"

namespace xgu{

class Invokable;

// TODO: Use SList instead of deque.
class InvocationList: private deque<Invokable*>
{
public:
	InvocationList(void);
	~InvocationList(void);

	static void DoEvents();

	static void Register(Invokable& invokable);
	static void Unregister(const Invokable& invokable);

private:
	const Thread::TID tid_;
	deque<Invokable*> invokable_list_;

private:
	static Lock global_lock_;
	static Thread::TLS invoke_queue_tls_;
};

}
